<pre class="docs-method-signature"><code>path.segmentIndexAtLength(length [, opt])</code></pre>
<p>Return the index of the path segment that contains a point that lies <code>length</code> away from the beginning of the path.</p>

<p>If negative <code>length</code> is provided, the algorithm starts looking from the end of the path. If <code>length</code> is higher than path length, the closest visible path segment is returned. Invisible segments (e.g. Moveto segments) have no length and are therefore skipped by the algorithm. If the path contains no visible segments, <code>null</code> is returned. If the path has no segments at all, <code>null</code> is returned, as well.</p>

<p>The <code>opt</code> argument is optional. Two properties may be specified, <code>opt.precision</code> and <code>opt.segmentSubdivisions</code>, which determine maximum error allowed in <code>pointAtLength</code> <a href="#g.Curve.prototype.pointAtLength">calculations</a> for curved segments (default precision is 3; this corresponds to maximum observed error of 0.1%). The <code>opt.segmentSubdivisions</code> property is an array of individual segments' <a href="#g.Curve.prototype.getSubdivisions">subdivision arrays</a>. The <code>path.getSegmentSubdivisions()</code> <a href="#g.Path.prototype.getSegmentSubdivisions">function</a> may be used to obtain the <code>segmentSubdivisions</code> array. The <code>opt.precision</code> property is still necessary, however; it determines the precision of the point search algorithm in curved segments.</p>
